package com.itheima.excel_demo.controller;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.itheima.excel_demo.mapper.ExcelDataMapper;

import java.util.List;

public class ExcelDataListener extends AnalysisEventListener<ExcelDataMapper> {
    private final List<String> result;

    public ExcelDataListener(List<String> result) {
        this.result = result;
    }

    @Override
    public void invoke(ExcelDataMapper data, AnalysisContext context) {
        result.add(data.toString());
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext context) {
    }
}
